@{
    ViewBag.Title = "摩斯密码加密解密";
    ViewBag.keywords = "摩斯密码加密解密";
    ViewBag.description = "在线摩斯密码加密解密";var host = Appsettings.app("BaseFile:HostUrl");
}
<div class="layui-row layui-form layui-form-pane morse">
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">内容：</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" id="content" name="content" rows="8" lay-verify="required" autocomplete="off" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <a class="layui-btn enc">加密</a>
        <a class="layui-btn layui-btn-normal dec">解密</a>
        <a class="layui-btn layui-btn-danger cle">清空</a>
        <a class="layui-btn layui-btn-primary copy">复制结果</a>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">输出：</label>
        <div class="layui-input-block">
            <textarea placeholder="输出内容" id="outtxt" name="outtxt" rows="8" autocomplete="off" class="layui-textarea"></textarea>
        </div>
    </div>
</div>
@section Scripts {
<script type="text/javascript">
    layui.config({ base: '@host/js/' }).use(['common'],function(){ $=layui.jquery;var common=layui.common;var Morse=layui.Morse;     
        let area_input = document.getElementById('content');let area_output = document.getElementById('outtxt');
    $(".morse .enc").bind("click", function () {
        var content = area_input.value;
        if (content === undefined || content === '' || content === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
        area_output.value = Morse.encode(area_input)
    });
    $(".morse .dec").bind("click", function () {
        var content = area_input.value;
        if (content === undefined || content === '' || content === null) { layer.msg("内容不能为空.", { icon: 2 }); return; }
        area_output.value = Morse.decode(area_input)
    });
    });
</script>
}